import dayjs from 'dayjs'

export default {
  data() {
    return {
      startTime: null,
      totalTime: 0
    }
  },
  methods: {
    setStartTime() {
      this.startTime = dayjs()
    },
    setTotalTime(minute) {
      const totalTime = dayjs().diff(this.startTime, 'second')
      this.totalTime += totalTime
      if (minute) {
        this.totalTime = Math.ceil(this.totalTime / 60)
      }
    }
  }
}
